<?php

/*

Daily Item (daily_item.php)

*/

$rank_check = 1;
$page_title = "Daily Item";
include "header.inc.php";

print "$openHTML";

$findFingerPrizes = fetch("SELECT * FROM finger_prizes WHERE game = '$game'");
if ((!$findFingerPrizes[cheap_finger]) OR (!$findFingerPrizes[cheap_finger]) or (!$findFingerPrizes[cheap_finger]))
{
	if ($rank == 7)
	{
		$ifAdmin = "Admins: Click <a href=admin/admin_setup_finger.php?game=$game>here</a> to setup this game!<br>";
	}

	die("<p>" . $ifAdmin . "This game is not ready to be played yet.</p>");
}

	// Start Check

	$checking = "dailyitem";
	$limit1 = $datestamp;

	$findCheck = fetch("SELECT * FROM checking2 WHERE userid = '$userid' AND check_what = '$checking' AND timestamp = '$limit1' AND game = '$game'");

	if ($findCheck[id])
	{
		$page_title = "Daily Item - Already Played";
		$findPage = fetch("SELECT * FROM game_pages WHERE page_title = '$page_title' AND game 		= '$game'");
		if ($findPage[page_info] == "")
		{
			print "<p>You approach Mumbly Joe and he holds out his finger, but he's pointing 		for you to go away. As you walk off you hear him saying \"Come back tomorrow!\"</p><p 		align=center><img src=$base_url/images/games/finger.jpg></p>";
		}
		else
		{
			include "showpage.inc.php";
			print "$findPage[page_info]";
		}
	}

	if (!$findCheck[id])
	{
		$page_title = "Daily Item - About to Play";
		$findPage = fetch("SELECT * FROM game_pages WHERE page_title = '$page_title' AND game 		= 	'$game'");
		if ($findPage[page_info] == "")
		{
			print "<p>Hi! I'm Mumbly Joe, and I've got a surprise for you, all you gotta do 	is 	pull my finger. You know you want to!</p><p align=center><a 		href=$base_url/daily_item.pro.php?game=$game><img 		src=$base_url/images/games/finger.jpg></a></p>";
		}
		else
		{
			include "showpage.inc.php";
			print "$findPage[page_info]";
		}
	}

	// End Check

print "$closeHTML";

?>